# Maintainer: David Runge <dvzrv@archlinux.org>

_name=cfgv
pkgname=python-cfgv
pkgver=3.4.0
pkgrel=1
pkgdesc="Validate configuration and produce human readable error messages"
arch=(any)
url="https://github.com/asottile/cfgv"
license=(MIT)
depends=(python)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(python-pytest)
source=($_name-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz)
sha512sums=('7d3939bb99bc446f30774cad8f0ddeb1ff867e63d19e4178e5c5281b8f4300c08375936170b8ab0278b040439f59d0276b0c8924f02cd410e73037fb4729af57')
b2sums=('fa84c7307e32e9f19d2ec0c806afc0d54f4a5f7767d2f4f755d73bafa80425513717160e722752fb41cfbfcb8c1cb11bd363ac41e99265c19dd18166b24d6d64')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:$PYTHONPATH"
  pytest -v
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
